home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Free 29
/
Commodore_Free_Issue_29_2009_Commodore_Computer_Club.d64
/
biz calc desc
< prev
next >
Wrap
Text File
|
2023-02-26
|
15KB
|
553 lines
u
EDITOR'S NOTE:
The 'C16 BIZ CALC' program is stored
on this disk. However, it is written
for the C16 in a version of BASIC that
is not compatible with C64 BASIC V2.
The program will RUN on a C128 with
BASIC V7 if you LOAD it with:
LOAD"C16 BIZ CALC",8
If you just want to view the program
listing on your C64, RESET your
computer & type:
LOAD"C16 BIZ CALC",8
When ready appears type LIST.
***********************************
* Business Calculator Description.*
* The Masterpiece! *
***********************************
Databases and Spreadsheets are
great...
if you can spare half your life to
learn them, then spend the other half
Wrestling with cells and complicated
Mathematical formulas etc. Business
Calculator (Biz Calc from now on)
attempts to take all that trauma and
hassle away and let the user get
straight into it.
Originally started out of a personal
annoyance that shops less and less
include VAT in the price. (Does
any-one out there share this? I
resent it being rubbish at Maths; and
quite slow! as yet another deception
based on greed in my view. But what
can I do about it!) Anyway, the
program grew into helping some-one
with their small business -so I don't
hate commerce completely..?
TUTORIAL
It has become rather larger than
simply working out how much the blood
suckers will take. For those without
a business, it may better to find VAT
Calculator, the prequel to this
program. All the features are here,
but the inclusions for business may
make it more complicated to
understand. So here's a How To... of
all the business features. ...Simply
read the listing from 1500 !
Perhaps I haven't explained key press
2 properly. Though a bit of trial
and error rehearsal will see most
pick it up quickly. While one
"1" counts up a list of expenses.
"2" allows the user to Add to the
takings, or change it altogether.
There isn't a list for income as I
did not see a need. This is printed
as positives to add before taking
from takings. (see! Not at all
complicated -"pff !") The total is
listed on the main menu as "Total
Expense:" (Sorry, if that's somewhat
dull or predictable.)
"4", you will notice only the top
figures are changed. In case a quick
reference is needed to a possible
purchase, but the program needs
keeping in tact. Although it also
affects both percentage / takings
listings. (possibly a bug. Or down
to the fact I wrote this blindly for
a friend who I haven't seen in a long
time, I hope that my efforts would be
of some use to him. ...Clearly not,
as he still isn't speaking!)
"0" resets expense list. And I've
got to say, in looking at it again
The "To Tax Man/persons" only looks
anywhere near right when there are no
expenses to work out! We may look at
this in the program description that
follows. And may arrive at a
solution such as changing to "Total
Outgoing", or adding this, and
working out what Tax is actually
paid.
Looking at the program.
-----------------------
My first lesson in debugging or
describing to others what things do,
was to make a note at the time of the
variables. As now when I look some
weeks later it's like trying to get
sense out of a politician! At this
point I will be nothing short of
amazed if I remember everything. And
will have to look deeper into the
code than I wanted to. This is more
time consuming, and I have the
washing up to do yet!
Here's what I do know:
----------------------
Line 10 Always title your program in
the first line of your code. The
easiest way to know what it is.
Line 20 I wanted background colour
white, and the ink to be mostly
black. (reminds me of a song I sang
at school) People were saying they
were having trouble reading the other
colours. The border on the other
hand is reserved for something quite
special which I will come to in due
course. The border is set this way
as the best choice only minor trouble
being there seems no way to get the
original border colour. Ah! well.
If you know of a way, please let me
know.
Line 30 Clear memory of all prior
memory, but keeping the program.
- ML is Maximum Limit for list.
Tinker with this if you need to.
- XP is short for "expense" -(haha!
Nothing like Windows then eh!) It
allows for a listing related to ML.
It is also possible to type in a list
of Income if needed for TaxMan/Person
etc.
- VA is VAT or Value Added Tax.
(nice to assume "Value" anyway..
This is set to the current rate. Can
be changed either by altering the
figure here, and saving. Or during
the program which can also be saved.
- T is Takings. Presetting an amount
is useful. It not only saves awkward
bugs. It allows for examples to show
the program is working.
- XP$ is linked to xp in that it is
the string corresponding to the
number
- c% is the colour for the menu
later. You will see in line 20 the
command ...Color4,6. Border colour
of 6. Which could have been done
quite differently so that if a change
were needed only one line would need
changing. Try moving "CLR" to the
start of 20, put "C%=6" straight
after it, followed by the colours.
And change the colour 4, to c%. Then
if you want to start with a new
border colour you only need to change
the c%=... Within the legal range
1-16 (off the top of my head) This is
so it doesn't look funny when you go
to the border changing menu.
Line 40 Set maximum volume.
Line 50 Saves time retyping a
commonly used string.
Line 60 SCNCLR: A way of clearing the
screen. Simply means "ScreenClear".
Like PRINT"ctrl & home"; On some
models of 8 bit computers it was or
IS simply CLS. And is the one of few
of the compatibility problems I can
think users may face when typing in
any of my programs in this series. I
haven't used POKES & PEEKS which
would be another problem as they have
meanings individual to the machines.
And VOL is a POKE statement on the
c64 (line40)
Line 70-90 establishes with user what
the current percentage is.
Line 100 type your own Total here.
Or the price of something you wish to
buy when the sales berk, sorry
"clerk" is being coy with the true
cost to your livelihood.
Line 110-120 prints info. for sake of
speed.
Line 130 does percentage calculation
(Yawn!)
Line 140-160 As 110-120
Line 170 Share the variable in order
to do something else with it later.
(This was easy to remember: As to
eat you must have something left over
after TAX -good Luck! And, like
sharing a meal. Empty = (time for)
Tee!)
Line 180 Make sure user has read
info. And is happy to go on.
Line 190 Needed as a point of
reference, so that if anything needs
to be added there is an extra '10' in
the process. The other reason is
that REM statements mark out a new
section better than leaving it to
PRINT, which could be anything.
Line 200-210 Clear Screen and print
Title Business Calc (bc$), and Main
Menu.
Line 220 Debugging, deciding best
order. If you find the others linked
to this statement, you can experiment
and see what they do. (remove REM to
try)
Line 230-260 Printing the menu, and
calculates This takes some
understanding. ..Good Luck! ..OK.
- VA = Percent, originally stood for
VAT.
- T, as it says is Takings: T-X:
- X being the result of the formula
you make the bare figure actually
work out as a percentage sum. Thus
instead of deducting 17.5 from the
current takings. X permeates this to
the appropriate percentage first.
Otherwise the answer is completely
different.
- Y relates to the other part of the
screen. As covered above.
Line 280 resets a variable to be used
to avoid even more embarrassment than
not knowing what I'm doing.
Line 290-310 Uses the above variable
in a for/next loop... for something
or other... (see 330) XP stands for
Expense. The little goes through the
list of expenses to total them.
Line 320-360 Self Explanatory
Line 370-380 Why MU??? I can't
remember. But this is where the TAX
is deducted as whole outgoings.
Line 390 Another GOTO statement
cancelled out by the preceding REM
command.
Line 400 Tells the computer if it has
gone above the on/off limit to reset
to off and follow line by line.
Line 410 If H% (meaning whether to
hide or not the instructions that may
make the program hard to read. If H%
is on (1) assume the user knows these
things.
Line 420-500 Self Explanatory
Line 510 The extra command, this
works anyway, see 620. A Question
you may be asking is Why hide it?
Especially as 2 or so arrow up
presses at the end of the line just
before the inverted commas will serve
to keep the page intact. The Answer.
Yes. But it would impede on
expanding elsewhere. It is aesthetic
therefore less important. Just saves
the user typing in the command of the
colour they prefer. Having said that
this isn't impossible as the program
can currently be read, though I did
try to get a compiler. No reply
though. Also, it would be easier
another way. Try reprogramming to
keep on the main menu, but cycle the
colours one way by pressing c. or as
you like with the arrow keys. It can
easily be done. A Gosub statement
with a return. A few REMs and Ouila!
Lines - Upto590 instructions already
covered.
Line 590 "Q" always have an escape
route!
Line 600 For Instructions.
err...press "I" key"
Line 610-620 covered above. Hide,
Colour.
Line 630 In case of faulty or erratic
pressing of keys. Now You wouldn't
do that would you???
Line 650 menu for key 1 (skip the
waffle)
Line 710 get a busier expense.
Line 720 put expense into next
available slot.
Line 730 why is that reading to total
expense equals total expense "minus"
expense? ...I hate Maths!!! ...Ah!
well, it seems to work.
Line 740 again skip rubbish if Hide
is on. OK.
Line 770 wait for key presses listed
if hide is off, as it is by default.
NOTE: Still can't get past line 730.
For experimental purposes, and
perhaps due to the fact I've been
doing this so long that time to wash
up has come round again! I have this
zany idea to change the minus "-" to
a plus "+" to see what happens. But
you'll have to find this out for
yourselves...or 1 million in gold
bullion should do nicely! -not at all
overpriced! (... ??? Did I just
write how to find out? ..."tut!")
Line 780-790 allows further additions
if maximum Limit is not reached. Try
adding an "=", next to the "<" in
780. (an oversight). This will make
full use of the dimensioned array
(AKA. "slots") available.
Line 800-810 sends people away (with
smacked handies) if they reach the
limit. There's room in memory to
expand Max Limit (ML) if required. Up
to 1280 seems self explanatory
enough. Except for 1030-1130 which
is special The FOR... at 1060 starts
the list.
Line 1070 looks to see whether a key
has been pressed as this will be
stored in the relevant memory
location.
Line 1080 If it has a P then it
carries out this instruction, and
everything else is Halted! Until it
has another P. And the program is
returned here from the similar sub at
2330.
1090 If there's nothing in the slot
we go back to the main menu. (this
will only happen if slot 0 has
nothing in it. As ML expands with
the user input.
Line 1100 otherwise Print what's
there.
Line 1110 continues with the next on
the list.
Line 1120-1130 And on to the main sub
for awaiting another key press.
Line 1140 tells us this is the
editing tool. So in Menu "3", the
user pressed E. (that might be worth
noting.)
Line 1160 get out clause, if all else
fails. (Like Government funding
doesn't come through or whatever.)
Line 1190 If nn is greater than ml.
Denotes that ML is the marker as to
where the last filled slot is. So
currently if 56 was typed in, the
program would think what is going on
here? And send the user back to
retype a "legal" or usable number.
Otherwise we may proceed provide we
didn't mess about with the minus
symbol.
Line 1200 prints a reminder to reduce
occurrence of error.
Line 1220 checks there's something to
change or make reference to.
Line 1230 Waits for key press
Line 1240-1270 Self explanatory, or
explained previously.
Line 1280-1300 gets new number.
Line1310 puts new number in to
replace old. ("New lamps for old"
seems fitting somehow.)
Line 1320 if Hide is on. Computer
makes a sound to inform user this has
been carried out, and is about ready
to proceed.
Line 1330 perhaps, there should be a
yes or no option here. It is more
complicated to put in than first
glance would indicate.
TRY:
1471 geta$;ifa$=""then1471
1472 ifa$<>"n"thenpp=1 :goto 980
Add at 1015 ifpp=1thenpp=0: goto 480
AND THERE WE HAVE AN INSTANCE, A
CLEAR EXAMPLE OF HOW CODE TURNS INTO
SPAGHETTI. And Bolognese to it!At
this stage it would be hard to get
round this, short of a re-write (good
luck with that one!), even than a
jumbled up mess can still occur.
Particularly if you suffer from Ideas
aplenty (sense? err none. In my
case). The other way you'll notice
at 970 it also says what 1470
reprints. This is an attempt at
memory jogging without the need to go
into it again. Which shouldn't be
necessary with a few dummy runs. And
in Yape The plus4 emulator which this
was programmed in. You can open a
second instance of the same program
for reference if you get stuck.
Line 1490 If you press to quit it
will go here and END. This seemed
like a good place to mark the program
out from additional extras.
Line 2320 End of Instructions.
("feuwpf!")
Line 2300-2400 where program comes to
in above menu. Why here? Well, it
comes here in multiple parts of the
program. So it was best to have it
in one place.
Line 2410-2590 My favourite idea of
all time. A simple but very pleasing
idea. That if some-one has to work
late, or for long hours. They can
alter what they have to look at.
TIP:
----
You could set an automatic option
using ti$, where if set to on the
border changes automatically, even at
random. Reset ti$ and have instances
of checking throughout the program.
Firstly, it is important to note that
while many of the commands look the
same. (geta$, ifa$..., etc.) they do
not have to be placed the same way.
Here you'll notice line2480 Geta$ Not
"geta$:ifa$=""then2480" this blocks
the program from moving until a key
is pressed, however we let it
continue in a loop. (In all truth I
was trying to put it more firmly into
mind here that this can be done. As
every book I seem to have read seems
to only cover one way)
Line 1030-1130 The use of this is
better emphasised with the Pause
button, key press in the above menu.
But it is more complicated as to how
that is derived being in two places.
And as it is only needed with the
listing of expenses. Look at the
list generator to see how this works.
We've covered similar with AATimer
in the addition of an option in the
main menu. (I'm glad I could share
this, as when it came to me I was
overjoyed. Feeling I'd arrived
-somewhere- as an amateur programmer)
Rest is self explanatory.
Best Wishes
(c) John Fielden 2008
--